<?
	session_start();
	include("../model/database.php");
	include("../model/xl_nguoi_dung.php");
	$xl_nguoi_dung = new xl_nguoi_dung();
	
	if( isset($_REQUEST['iduser']))
	{
		$idnguoidung=$_REQUEST['iduser'];
		$tenanh=$_REQUEST['tenanh'];
		$xl_nguoi_dung->xoaAnhNguoiDung($idnguoidung);
		
		$nguoidung = $xl_nguoi_dung->layNguoiDung($idnguoidung);
		$row = $nguoidung[0];
		
		
		$_SESSION['usid'] = $idnguoidung;
		$_SESSION['email'] = $row['Email'];
		$_SESSION['ava'] = $row['HinhAnhDaiDien'];
		$_SESSION['fullname'] = $row['TenHienThi'];
		$_SESSION['oauth'] = $row['oauth_provider'];
		$success = true;
		
		$data = array("Success"=>$success,"AnonymousAvatar"=>"uploads/user/anonymous.png","Message"=>"không thành công","session"=>$_SESSION);
		$url="../uploads/user/".$tenanh;
		unlink($url);
		echo json_encode($data);
	}
?>
